Ext.define('AM.controller.GroupList', {
    extend: 'Ext.app.Controller',
	stores: ['Groups@AM.store',
			'GroupMemberOf@AM.store'],
			
    models: ['Group@AM.model'],
	views: ['GroupsView@AM.view.group', 
			'GroupMemberOfView@AM.view.group'],
			
	refs: [{ref: 'groupMemberOfView', selector:'groupMemberOfView'}],

    init: function(){
    	this.control({
            'groupsView': {
                itemclick: this.selectionChange,
            },
			'groupMemberOfView': {
                itemclick: this.selectionChange,
            }
        });
    },

    selectionChange: function(grid, record) {
		this.getGroupMemberOfView().getStore().load({url: 'http://localhost/Rest01/Service1.svc/groupMemberOf/' + record.data.Name});
    }

});